package com.eos.control.action.activity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SalesModel;
import com.hf.utils.PaginationBean;

public class BuyMethodListAction extends AbstractBaseAction {
	private static final long serialVersionUID = 581658896391821634L;
    private Integer pageNum;
    private Integer numPerPage;
    private List<SalesModel> salesModelList;
    private Integer totalCount;
    
	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}


	public Integer getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(Integer numPerPage) {
		this.numPerPage = numPerPage;
	}

	public List<SalesModel> getSalesModelList() {
		return salesModelList;
	}

	public Integer getTotalCount() {
		return totalCount;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String execute()   {
		try {
			if(pageNum == null || pageNum.intValue() ==0) pageNum = 1;
			if(numPerPage == null || numPerPage.intValue() ==0) numPerPage = PAGE_SIZE;
			SysActivityBusinessService sabs = new  SysActivityBusinessService();
			Map<String, String> map = new HashMap<String, String>();
			map.put("table_name", "sales_model");
			map.put("status", ConstantTool.STATUS_OK);
			map.put("deal_flag", ConstantTool.DEAL_FALG_OK);
			map.put("page_size", numPerPage+"");
			map.put("cur_page", pageNum+"");
			PaginationBean pageBean = sabs.getSalesModelList(map);
			totalCount = null != pageBean ? pageBean.getMaxcount() : 0;
			salesModelList = null != pageBean ? (List<SalesModel>)pageBean.getResultList() : null;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}
}
